const fs = require('fs');
const software_version = JSON.parse(fs.readFileSync('package.json')).version;
const Os = require('os');
module.exports = class extends think.kms.center {
  async indexAction() {
    this.meta_title = '首页';
    this.active = ['/', '/index', 'index.html'];
    const mysqlv = await this.model('mysql').query('select version()');
    const node = process.versions;
    const maxPost = this.config('post_max_fields_size');
    const maxUpload = this.config('post_max_file_size');
    this.assign({
      app_version: software_version,
      ThinkJS_version: think.version,
      'nodejs_v': node.node,
      'OS': Os.type(),
      'thinkjs': think.version,
      'maxPost': maxPost,
      'maxUpload':maxUpload,
      'mysqlv': mysqlv[0]['version()']
    })
    return this.display();
  }

  async mainAction() {
    this.meta_title = '首页-系统信息';
    var data = await this.model('document');
    this.assign('data', {
      title: '系统信息',
      osInfo: {
        think_version: think.version
      }
    });
    return this.display();
  }
};
